package api

import (
	"github.com/gin-gonic/gin"
	jwt2 "github.com/golangblogs/gojwt"
	"im/api/handler"
	"im/consts"
)

func RouterLogin(r *gin.Engine) {
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/createUser", handler.CreateUser) //注册
			user.POST("/loginUser", handler.LoginUser)   //登录
			user.POST("/listUser", handler.ListUser)     //用户表
		}
		mate := api.Group("/make")
		{
			mate.POST("/apply", handler.ApplyUser)       //用户申请
			mate.POST("/updateMate", handler.UpdateMate) //修改申请
			mate.POST("/deleteMate", handler.DeleteMate) //删除好友
		}
		chat := api.Group("/char")
		{
			chat.Use(jwt2.JWTAuth(consts.JWT_SELECT_KEY))
			chat.GET("/char", handler.Chat) //wep
		}
	}
}
